<?php
/*
 * @Descripttion: 
 * @version: 
 * @Author: Mr. Xu
 * @Date: 2020-12-14 10:44:37
 * @LastEditors: Mr. Xu
 * @LastEditTime: 2020-12-18 10:53:35
 */

namespace app\admin\controller;

use think\Db;

class Config extends Base
{
    public function base()
    {
        return $this->fetch();
	}
	// 站点配置
    public function site()
    {
        $param = $this->request->post();
        if($this->request->isPost()) {
            $post = $this->request->post();
            $validate = new \think\Validate([
                ['clientId', 'require', '应用标识不能为空'],
            ]);
            if (!$validate->check($post)) {
                $this->error('提交失败：' . $validate->getError());
            }
            if(false == Db::name('config')->where('name','check_base')->update(['value'=>json_encode($param)])) {
                return toError(404,"提交失败");
            }else{
                return toSuccess('提交成功');
            }
        }
        $list = db('config')->where('name','check_base')->find();
        $this->assign('list',json_decode($list['value'], true));
        return $this->fetch();
    }
    
    
	
}
